﻿using LimaLims.Application.Service.Base.Dto;
using LimaLims.Core;
using LimaLims.Core.Entity.Basic;
using LimaLims.Core.Enum;
using LimaLims.Core.Util;
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;

namespace LimaLims.Application.Service.Basic.Dto
{
    /// <summary>
    /// 试验方案DTO
    /// </summary>
    public class AddInspectionSchemeInput : BaseDto
    {
        /// <summary>
        /// 编号
        /// </summary>
        public string Code { get; set; }

        /// <summary>
        /// 名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }

        /// <summary>
        /// 试验方案项目集合
        /// </summary>
        public ICollection<InspectionDataDto> InspectionDatas { get; set; }
    }

    public class EditInspectionSchemeInput : AddInspectionSchemeInput
    {

    }

    public class InspectionDataDto
    {
        /// <summary>
        /// 编号
        /// </summary>
        public string Code { get; set; }
        /// <summary>
        /// 试验方案Id
        /// </summary>
        public long InspectionSchemeId { get; set; }

        /// <summary>
        /// 试验项目名称
        /// </summary>
        public string InspectionName { get; set; }

        /// <summary>
        /// 试验方法及要求
        /// </summary>
        public string Remark { get; set; }

        /// <summary>
        /// 试验项
        /// </summary>
        public InspectionType InspectionType { get; set; }

        /// <summary>
        /// 国标目标值
        /// </summary>
        public float? NsTargetValue { get; set; }

        /// <summary>
        /// 国标规格下限
        /// </summary>
        public float? NsLowerLimit { get; set; }

        /// <summary>
        /// 国标规格上限
        /// </summary>
        public float? NsUpperLimit { get; set; }


        /// <summary>
        /// 客户设计值
        /// </summary>
        public float? SjTargetValue { get; set; }

        /// <summary>
        /// 设计规格下限
        /// </summary>
        public float? SjLowerLimit { get; set; }

        /// <summary>
        /// 设计规格上限
        /// </summary>
        public float? SjUpperLimit { get; set; }

    }

    public class InspectionSchemeOutput
    {
        public long Id { get; set; }

        public string Code { get; set; }

        public string Name { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? CreatedTime { get; set; }
        /// <summary>
        /// 最后修改时间
        /// </summary>
        public DateTime? UpdatedTime { get; set; }
        /// <summary>
        /// 创建人
        /// </summary>
        public string CreatedUserName { get; set; }

        /// <summary>
        /// 最后修改者
        /// </summary>
        public string UpdatedUserName { get; set; }

        public bool ValidStatus { get; set; }

        public int Sort { get; set; }

    }

    public class InspectionSchemeDetail: InspectionSchemeOutput
    {
        public ICollection<InspectionData> InspectionDatas { get; set; }
    }


    public class InspectionSchemeShowDetail : InspectionSchemeOutput
    {
        public ICollection<InspectionDataOutput> InspectionDatas { get; set; }
    }


    public class InspectionDataOutput
    {
        public string Code { get; set; }

        public long Id { get; set; }
        /// <summary>
        /// 试验方案Id
        /// </summary>
        public long InspectionSchemeId { get; set; }

        /// <summary>
        /// 试验项目
        /// </summary>

        public InspectionType InspectionType { get; set; }

        /// <summary>
        /// 试验项目描述
        /// </summary>
        public string InspectionTypeText=> InspectionType.GetDescription();

        /// <summary>
        /// 试验项目名称
        /// </summary>
        public string InspectionName { get; set; }

        /// <summary>
        /// 试验方法及要求
        /// </summary>
        public string Remark { get; set; }

        /// <summary>
        /// 国标目标值
        /// </summary>
        public float? NsTargetValue { get; set; }

        /// <summary>
        /// 国标规格下限
        /// </summary>
        public float? NsLowerLimit { get; set; }

        /// <summary>
        /// 国标规格上限
        /// </summary>
        public float? NsUpperLimit { get; set; }

        /// <summary>
        /// 客户设计值
        /// </summary>
        public float? SjTargetValue { get; set; }

        /// <summary>
        /// 设计规格下限
        /// </summary>
        public float? SjLowerLimit { get; set; }

        /// <summary>
        /// 设计规格上限
        /// </summary>
        public float? SjUpperLimit { get; set; }

    }


    /// <summary>
    /// 试验方案分页
    /// </summary>
    public class InspectionSchemePageInput : PageInputBase
    {
        public string Code { get; set; }
    }


}
